package com.dragon.repository.domain.dto;

import com.dragon.repository.entity.Mod;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.dragon.common.util.BeanUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Date;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ModDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    private Integer id;

    @ApiModelProperty(value = "模块key")
    private String modId;

    @ApiModelProperty(value = "模块名称")
    private String modName;


    public ModDTO() {}

    public ModDTO(Mod entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static ModDTO convert(Mod entity) {
        return new ModDTO(entity);
    }

    public static List<ModDTO> convertList(List<Mod> list) {
        List<ModDTO> resultList = new ArrayList<>();
        for (Mod entity : list) {
            resultList.add(new ModDTO(entity));
        }
        return resultList;
    }}
